import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/base/JVxeTable/types';
import { getWeekMonthQuarterYear } from '/@/utils';

//列表数据
export const columns: BasicColumn[] = [
  {
    title: '立项名称',
    dataIndex: 'projectName',
    width: 'auto',
    align: 'left',
  },
  {
    title: '项目责任主体',
    dataIndex: 'responsibleEntity_dictText',
    width: 'auto',
    align: 'left',
  },
  //  {
  //   title: '立项编码	',
  //   align:"center",
  //   dataIndex: 'projectCode'
  //  },
  {
    title: '项目类别',
    dataIndex: 'projectType_dictText',
    width: 'auto',
    align: 'left',
  },
  {
    title: '版本号',
    dataIndex: 'visionNo',
    width: 'auto',
  },
  {
    title: '立项总金额',
    dataIndex: 'projectAmountSummary',
    width: 'auto',
  },
  {
    title: '流程状态',
    dataIndex: 'processStatus',
    width: 'auto',
    format: (text) => {
      switch (text) {
        case 'COMPLETE':
          return '审批通过';
        case 'TERMINATION':
          return '审批终止';
        case 'RUNNING':
          return '审批中';
        case 'DRAFT':
          return '待提交';
        default:
          return '';
      }
    },
    align: 'left',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '立项名称	',
    field: 'projectName',
    component: 'JInput',
  },
  {
    label: '立项编码	',
    field: 'projectCode',
    component: 'JInput',
  },
  {
    label: '项目类别',
    field: 'projectType',
    component: 'JSelectMultiple',
    componentProps: {
      dictCode: 'project',
    },
    //colProps: {span: 6},
  },
  {
    label: '集团归口部门',
    field: 'hasSubBudget',
    component: 'JSelectDept',
    componentProps: {},
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '立项名称	',
    field: 'projectName',
    filedkey: 'project_proposal_preparation_project_name',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入立项名称	!' }];
    },
  },
  {
    label: '立项编码	',
    field: 'projectCode',
    filedkey: 'project_proposal_preparation_project_code',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { ...rules.duplicateCheckRule('project_proposal_preparation', 'project_code', model, schema)[0] }];
    },
  },
  {
    label: '编制时间',
    field: 'compileDate',
    filedkey: 'project_proposal_preparation_compile_date',
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
    },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入编制时间!' }];
    },
  },
  {
    label: '项目类别',
    field: 'projectType',
    filedkey: 'project_proposal_preparation_project_type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'project',
    },
  },
  {
    label: '版本号',
    field: 'visionNo',
    filedkey: 'project_proposal_preparation_vision_no',
    defaultValue: '0',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [
        { required: true, message: '请输入版本号!' },
        { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' },
      ];
    },
  },
  {
    label: '是否需集团审批',
    field: 'needExpert',
    filedkey: 'project_proposal_preparation_need_expert',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yn',
      type: 'radio',
    },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入是否需集团审批!' }];
    },
  },
  {
    label: '需集团审批原因',
    field: 'expertReason',
    filedkey: 'project_proposal_preparation_expert_reason',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入需集团审批原因!' }];
    },
  },
  {
    label: '集团归口部门',
    field: 'hasSubBudget',
    filedkey: 'project_proposal_preparation_has_sub_budget',
    component: 'JSelectDept',
    componentProps: {},
  },
  {
    label: '项目责任主体',
    field: 'responsibleEntity',
    filedkey: 'project_proposal_preparation_responsible_entity',
    component: 'JSelectDept',
    componentProps: {},
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入项目责任主体!' }];
    },
  },
  {
    label: '编制依据',
    field: 'compileBasis',
    filedkey: 'project_proposal_preparation_compile_basis',
    component: 'InputTextArea',
  },
  {
    label: '工程量说明',
    field: 'quantityDesc',
    filedkey: 'project_proposal_preparation_quantity_desc',
    component: 'InputTextArea',
  },
  {
    label: '单价说明',
    field: 'unitPriceDesc',
    filedkey: 'project_proposal_preparation_unit_price_desc',
    component: 'InputTextArea',
  },
  {
    label: '费用计算说明',
    field: 'costCalculationDesc',
    filedkey: 'project_proposal_preparation_cost_calculation_desc',
    component: 'InputTextArea',
  },
  {
    label: '对标分析',
    field: 'benchmarkAnalysis',
    filedkey: 'project_proposal_preparation_benchmark_analysis',
    component: 'InputTextArea',
  },
  {
    label: '立项金额说明',
    field: 'projectAmountDesc',
    filedkey: 'project_proposal_preparation_project_amount_desc',
    component: 'InputTextArea',
  },
  {
    label: '立项总金额',
    field: 'projectAmountSummary',
    filedkey: 'project_proposal_preparation_project_amount_summary',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }];
    },
  },
  
  {
    label: '审核依据',
    field: 'auditBasis',
    filedkey: 'project_proposal_preparation_audit_basis',
    component: 'Input',
  },
  {
    label: '审核原则',
    field: 'auditPrinciple',
    filedkey: 'project_proposal_preparation_audit_principle',
    component: 'Input',
  },
  {
    label: '审核意见',
    field: 'auditOpinion',
    filedkey: 'project_proposal_preparation_audit_opinion',
    component: 'Input',
  },
  {
    label: '备案编号',
    field: 'recordNumber',
    filedkey: 'project_proposal_preparation_record_number',
    component: 'Input',
  },
  {
    label: '备案金额',
    field: 'recordAmount',
    filedkey: 'project_proposal_preparation_record_amount',
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ required: false }, { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }];
    },
  },
  {
    label: '备案原因',
    field: 'recordReason',
    filedkey: 'project_proposal_preparation_record_reason',
    component: 'Input',
  },
  {
    label: '其他备案附件',
    field: 'otherRecordAttachmentsString',
    filedkey: 'project_proposal_preparation_other_record_attachments',
    component: 'JUpload',
    componentProps: {},
  },
  {
    label: '附件信息',
    field: 'attachmentInfo',
    filedkey: 'project_proposal_preparation_attachment_info',
    component: 'JUpload',
    componentProps: {},
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入附件信息!' }];
    },
  },
  // {
  //   label: '流程实例id',
  //   field: 'processInstanceId',
  //   filedkey: 'project_proposal_preparation_process_instance_id',
  //   component: 'Input',
  // },
  // {
  //   label: '流程状态',
  //   field: 'processStatus',
  //   filedkey: 'project_proposal_preparation_process_status',
  //   component: 'Input',
  // },
  // {
  //   label: '流程定义key',
  //   field: 'processKey',
  //   filedkey: 'project_proposal_preparation_process_key',
  //   component: 'Input',
  // },
  // {
  //   label: '流程当前节点',
  //   field: 'processLocation',
  //   filedkey: 'project_proposal_preparation_process_location',
  //   component: 'Input',
  // },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
//子表单数据
//子表表格配置
export const projectAmountDetailColumns: JVxeColumn[] = [
  {
    title: '立项编号',
    key: 'projectId',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_project_id',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '立项名称',
    key: 'projectName',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_project_name',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '项目编码',
    key: 'itemCode',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_item_code',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '项目名称',
    key: 'itemName',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_item_name',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '父级编码',
    key: 'parentCode',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_parent_code',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '清单类型',
    key: 'listType',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_list_type',
    type: JVxeTypes.select,
    options: [],
    dictCode: 'list_type',
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '单位',
    key: 'unit',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_unit',
    type: JVxeTypes.select,
    options: [],
    dictCode: '',
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '送审数量',
    key: 'submitQuantity',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_submit_quantity',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '送审单价',
    key: 'submitUnitPrice',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_submit_unit_price',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '送审合价',
    key: 'submitTotalPrice',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_submit_total_price',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '审核数量',
    key: 'auditQuantity',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_audit_quantity',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '审核单价',
    key: 'auditUnitPrice',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_audit_unit_price',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '审核合价',
    key: 'auditTotalPrice',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_audit_total_price',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
    validateRules: [{ required: false }, { pattern: 'n', message: '${title}格式不正确' }],
  },
  {
    title: '增减金额',
    key: 'amountChange',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_amount_change',
    type: JVxeTypes.inputNumber,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '审核意见',
    key: 'auditComment',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_audit_comment',
    type: JVxeTypes.textarea,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '总表项目编码',
    key: 'projectProposalPreparationId',
    // 新增 filedkey 属性
    filedkey: 'project_amount_detail_project_proposal_preparation_id',
    type: JVxeTypes.input,
    width: '200px',
    placeholder: '请输入${title}',
    defaultValue: '',
  },
];

// 高级查询数据
export const superQuerySchema = {
  projectName: { title: '立项名称	', order: 0, view: 'text', type: 'string' },
  projectCode: { title: '立项编码	', order: 1, view: 'text', type: 'string' },
  projectType: { title: '项目类别', order: 3, view: 'list', type: 'string', dictCode: 'project' },
  visionNo: { title: '版本号', order: 4, view: 'text', type: 'string' },
  responsibleEntity: { title: '项目责任主体', order: 8, view: 'sel_depart', type: 'string' },
  projectAmountSummary: { title: '立项总金额', order: 15, view: 'number', type: 'number' },
  processStatus: { title: '流程状态', order: 25, view: 'text', type: 'string' },
  //子表高级查询
  projectAmountDetail: {
    title: '立项金额附表',
    view: 'table',
    fields: {
      projectId: { title: '立项编号', order: 0, view: 'text', type: 'string' },
      projectName: { title: '立项名称', order: 1, view: 'text', type: 'string' },
      itemCode: { title: '项目编码', order: 2, view: 'text', type: 'string' },
      itemName: { title: '项目名称', order: 3, view: 'text', type: 'string' },
      parentCode: { title: '父级编码', order: 4, view: 'text', type: 'string' },
      listType: { title: '清单类型', order: 5, view: 'list', type: 'string', dictCode: 'list_type' },
      unit: { title: '单位', order: 6, view: 'list', type: 'string', dictCode: '' },
      submitQuantity: { title: '送审数量', order: 7, view: 'number', type: 'number' },
      submitUnitPrice: { title: '送审单价', order: 8, view: 'number', type: 'number' },
      submitTotalPrice: { title: '送审合价', order: 9, view: 'number', type: 'number' },
      auditQuantity: { title: '审核数量', order: 10, view: 'number', type: 'number' },
      auditUnitPrice: { title: '审核单价', order: 11, view: 'number', type: 'number' },
      auditTotalPrice: { title: '审核合价', order: 12, view: 'number', type: 'number' },
      amountChange: { title: '增减金额', order: 13, view: 'number', type: 'number' },
      auditComment: { title: '审核意见', order: 14, view: 'textarea', type: 'string' },
      projectProposalPreparationId: { title: '总表项目编码', order: 15, view: 'text', type: 'string' },
    },
  },
};

//流程表单数据
export const formBpmSchema: FormSchema[] = ({ judgeIf, judeRequired, judgeRead }): FormSchema[] => [
  {
    label: '立项名称	',
    field: 'projectName',
    filedkey: 'project_proposal_preparation_project_name',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '立项编码	',
    field: 'projectCode',
    filedkey: 'project_proposal_preparation_project_code',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ ...rules.duplicateCheckRule('project_proposal_preparation', 'project_code', model, schema)[0] }];
    },
  },
  {
    label: '编制时间',
    field: 'compileDate',
    filedkey: 'project_proposal_preparation_compile_date',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'DatePicker',
    componentProps: {
      valueFormat: 'YYYY-MM-DD',
    },
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '项目类别',
    field: 'projectType',
    filedkey: 'project_proposal_preparation_project_type',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'project',
    },
  },
  {
    label: '版本号',
    field: 'visionNo',
    filedkey: 'project_proposal_preparation_vision_no',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    defaultValue: '0',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }];
    },
  },
  {
    label: '是否需集团审批',
    field: 'needExpert',
    filedkey: 'project_proposal_preparation_need_expert',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'yn',
      type: 'radio',
    },
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '需集团审批原因',
    field: 'expertReason',
    filedkey: 'project_proposal_preparation_expert_reason',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '集团归口部门',
    field: 'hasSubBudget',
    filedkey: 'project_proposal_preparation_has_sub_budget',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JSelectDept',
    componentProps: {},
  },
  {
    label: '项目责任主体',
    field: 'responsibleEntity',
    filedkey: 'project_proposal_preparation_responsible_entity',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JSelectDept',
    componentProps: {},
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '审核依据',
    field: 'auditBasis',
    filedkey: 'project_proposal_preparation_audit_basis',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '立项总金额',
    field: 'projectAmountSummary',
    filedkey: 'project_proposal_preparation_project_amount_summary',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }];
    },
  },
  {
    label: '编制依据',
    field: 'compileBasis',
    filedkey: 'project_proposal_preparation_compile_basis',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  {
    label: '工程量说明',
    field: 'quantityDesc',
    filedkey: 'project_proposal_preparation_quantity_desc',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  {
    label: '单价说明',
    field: 'unitPriceDesc',
    filedkey: 'project_proposal_preparation_unit_price_desc',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  {
    label: '费用计算说明',
    field: 'costCalculationDesc',
    filedkey: 'project_proposal_preparation_cost_calculation_desc',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  {
    label: '对标分析',
    field: 'benchmarkAnalysis',
    filedkey: 'project_proposal_preparation_benchmark_analysis',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  {
    label: '立项金额说明',
    field: 'projectAmountDesc',
    filedkey: 'project_proposal_preparation_project_amount_desc',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputTextArea',
  },
  
  {
    label: '审核原则',
    field: 'auditPrinciple',
    filedkey: 'project_proposal_preparation_audit_principle',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '审核意见',
    field: 'auditOpinion',
    filedkey: 'project_proposal_preparation_audit_opinion',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '备案编号',
    field: 'recordNumber',
    filedkey: 'project_proposal_preparation_record_number',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '备案金额',
    field: 'recordAmount',
    filedkey: 'project_proposal_preparation_record_amount',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'InputNumber',
    dynamicRules: ({ model, schema }) => {
      return [{ pattern: /^-?\d+\.?\d*$/, message: '请输入数字!' }];
    },
  },
  {
    label: '备案原因',
    field: 'recordReason',
    filedkey: 'project_proposal_preparation_record_reason',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '流程状态',
    field: 'processStatus',
    filedkey: 'project_proposal_preparation_process_status',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '流程定义key',
    field: 'processKey',
    filedkey: 'project_proposal_preparation_process_key',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '流程当前节点',
    field: 'processLocation',
    filedkey: 'project_proposal_preparation_process_location',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'Input',
  },
  {
    label: '附件信息',
    field: 'attachmentInfo',
    filedkey: 'project_proposal_preparation_attachment_info',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, true);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JUpload',
    componentProps: {},
    dynamicRules: ({ model, schema }) => {
      return [];
    },
  },
  {
    label: '其他备案附件',
    field: 'otherRecordAttachmentsString',
    filedkey: 'project_proposal_preparation_other_record_attachments',
    ifShow: ({ schema }) => {
      return judgeIf(schema.filedkey, true);
    },
    required: ({ schema }) => {
      return judeRequired(schema.filedkey, false);
    },
    dynamicDisabled: ({ schema }) => {
      return judgeRead(schema.filedkey, false);
    },
    component: 'JUpload',
    componentProps: {},
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData, { judgeIf, judeRequired, judgeRead }): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formBpmSchema({ judgeIf, judeRequired, judgeRead });
}

export const approvalRunTaskBo = {
  task_instance_id: '',
  command_id: '',
  command_type: '',
  task_comment: '',
  transfer_user_id: '',
  revoke_task_id: '',
  endorsement_user_id_list: '',
  notice_user_id_list: '',
  roll_back_node_id: '',
  attachment_id: '',
  sureMessage: '',
  optional_node_assignee: {},
};
